# Use MySQL binaries
export PATH=/usr/local/mysql/bin:$PATH

# JRuby
export JRUBY_HOME=/Users/ariejan/dev/jruby/jruby
export PATH=$PATH:$JRUBY_HOME/bin

# Glassfish
export GLASSFISH_HOME=/Users/ariejan/dev/glassfish
export PATH=$PATH:$GLASSFISH_HOME/bin

# Use MacPorts, least priority
export PATH=$PATH:/opt/local/bin:/opt/local/sbin
export DISPLAY=:0.0

# Editors
export EDITOR='mate'
export SVN_EDITOR='vim'

#### General
alias ra='cd ~/dev/ruby/rails_apps/'
alias home='cd ~'
alias l='ls -lahG'
alias h='history'
alias c='clear'
alias ..='cd ..'
alias ...='cd ../..'
alias ebash='mate ~/.profile &' # because i edit my bash_profile a lot with new things
alias rbash='source ~/.profile' # same as previous, after editing you have to source it for the new stuff to work
alias his='history | grep -i $1'

#### Git
alias gitst='git status'
alias gitb='git branch --color'
alias gitc='git commit'
alias gitco='git checkout'

#### Subversion
svn_add_all(){ # Add all non_added files
svn status | grep "^?" | awk '{print $2}' | xargs svn add
}
svn_remove_all(){ # remove all removed files
svn status | grep "^!" | awk '{print $2}' | xargs svn remove
}
alias sup='svn update'
alias sst='svn status'
alias ssc='svn status | grep ^C'
alias ssn='svn status | grep ^?'
alias ssr='svn status | grep ^!'
alias sr='svn resolved'
alias srm='svn remove'
alias sstu='svn status -u' # remote repository changes
alias scom='svn commit --username=ariejan'
alias svnclear='find . -name .svn -print0 | xargs -0 rm -rf' # Remove all .svn directories (recursive)

#### Rails
function cdra {
  cd ~/dev/ruby/rails_apps/$1
}
function cdgem {
  cd /usr/local/lib/ruby/gems/1.8/gems/; cd `ls|grep $1|sort|tail -1`
}
# alias irb='irb --readline -r irb/completion -rubygems' # use readline, completion and require rubygems by default for irb

# MRI Ruby
alias ss='./script/server' # start up the beast
alias sc='script/console' # obvious
alias a='autotest -rails' # makes autotesting even quicker

# Ariejan Code
alias ac='cd ~/dev/ariejancode'

# JRuby
alias jss='jruby script/server'
alias jsc='jruby script/console'
alias jsg='jruby script/generate'

#### TextMate
alias e='mate . &' #open current dir
alias et='mate .gitignore CHANGELOG README app/ config/ db/ lang/ lib/ public/ test/ vendor/ spec/ stories/ &'
function r(){
  cdra $1; et
}
